package com.ajie.controller;


import com.ajie.entity.SysPermission;
import com.ajie.service.SysPermissionService;
import com.ajie.utils.QueryInfo;
import com.ajie.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 权限数据控制层
 */
@RestController
@Api(tags = "权限数据")
@RequestMapping("/permission")
@Slf4j
public class SysPermissionController {

    @Autowired
    private SysPermissionService permissionService;


    @ApiOperation(value = "分页查询")
    @PostMapping("/findPage")
    public Result findPage(@RequestBody QueryInfo queryInfo){
        log.info("该文件名是：SysPermissionController,该方法是：findPage");
        return permissionService.findPage(queryInfo);
    }

    @ApiOperation(value = "添加权限")
    @PostMapping("/insert")
    public Result insert(@RequestBody SysPermission permission){
        log.info("该文件名是：SysPermissionController,该方法是：insert");
        return permissionService.insert(permission);
    }

    @ApiOperation(value = "删除权限")
    @DeleteMapping("/delete/{id}")
    public Result delete( @PathVariable("id") Long id){
        log.info("该文件名是：SysPermissionController,该方法是：delete");
        return permissionService.delete(id);
    }

    @ApiOperation(value = "修改权限")
    @PutMapping("/update")
    public Result update(@RequestBody SysPermission permission){
        log.info("该文件名是：SysPermissionController,该方法是：update");
        return permissionService.update(permission);
    }
    
    
    
    @ApiOperation(value = "查询所有权限")
    @GetMapping("/select")
    public Result select(){
        log.info("该文件名是：SysPermissionController,该方法是：select");
        return permissionService.select();
    }
    
}
